package com.example.myproject.controller;

import com.example.myproject.dto.CommonResponse;
import com.example.myproject.dto.like.LikeRequest;
import com.example.myproject.dto.like.LikeResponse;
import com.example.myproject.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/values/comments")
public class LikeController {

    @Autowired
    private LikeService likeService;

    @PostMapping("/{commentId}/like")
    public CommonResponse<LikeResponse> likeComment(
            @PathVariable("commentId") Integer commentId,
            @RequestBody LikeRequest req) {

        LikeResponse resp = likeService.toggleLike(commentId, req);
        return CommonResponse.success(resp);
    }
}